import pymysql
import sys
import random
import time
import logging
from urllib import parse

# 获取关键词
def get_keyword(url):
    str1 = parse.parse_qs(parse.urlparse(url).query)
    return str1['keyword'][0]

# 获取作者uid
def get_author_uid(url):
    str1 = parse.parse_qs(parse.urlparse(url).query)
    return str1['user_id'][0]

# 二维元组变一维列表
def handle_tuple(tuple_all):
	list1 = []
	for tuple1 in tuple_all:
		for tuple2 in tuple1:
			list1.append(tuple2)
	return list1